PR Praktikum aus Computergraphik und digitaler Bildverarbeitung SSe 2007
Martin Knecht, 0326294, martin.knecht#aon.at
Michael Schwärzler, 0325222, michael#schwaerzler.com
Supervisor: Oliver Mattausch |
Download
AdaptiveSoftshadows.zip (8,48 MB) |
Adaptive Softshadows
"Adaptive Softshadows" was developed in the summer
semester 2007 for the PR "Praktikum aus Computergraphic und digitaler Bildverarbeitung " at the Technical University of
Vienna. It is a software designed to visualize a new adaptive soft shadowing algorithm.
Generating a soft shadow by simply using lots of shadow maps is a computationally expensive task, because the stepsize has to be rather small to omit artifacts. Our algorithm implemented in this demo application uses an upper error bound to decide whether if the space between two shadow map sampling positions should be subdivided again or not. This approach makes it possible to get descent softshadows at low computational costs.
Technical details: The software was developed in C++/DirectX9.
Using the program
Once the program starts, you will see this screen:
GUI elements
You can change the following values:
- Light Size: Change the size of the light with the first slider
- Epsilon: You can choose an upper error bound for the softshadow calculation
- Max. depth diff.: Defines the threshold which is used to calculate the difference between two shadowmaps. Switch to the terrain scene to see its effect.
- Shadow map bias: With this slider you can change the shadowmap bias ;-)
- Switch on "Calculate from view point" to do the error calculation from the cameras view. You will then notice that the number of depth maps changes depending on the point of view
- Filter mode: There are some different filtering modes available
- Kernel size: Choose an appropriate kernel size
- Sampling distance: The distance between two kernel sample points
- Algorithm: To compare our algorithm you can choose between different soft shadowing algorithms
- Use Textures: Enable/disable texture rendering
- Show debug info: Turns the debug images on/off
Controls:
- The position and rotation of the shadow caster can be modified by pressing W, A, S, D, E, C (position) and I, J, K, L, U, M (rotation).
- To change the position or rotation of the light, just press and hold the ALT key additionally.
- Choose a different scene by pressing the keys from 1 - 6.
- F1 shows/hides the GUI elements.
Configuration:
You can use the xml file found in “./media/challenges” to build up your own shadow scenes. In the tag <softShadowLight> the Softshadow Light is defined. To add other objects to the scene you can use the <envObject> tag.
SoftshadowLight:
<softShadowLight>
<position>
<x>170</x>
<y>35</y>
<z>150</z>
</position>
<rotation>
<x>0</x>
<y>-90</y>
<z>135</z>
</rotation>
<length>10</length>
<epsilon>0.08</epsilon>
<mapsize>512</mapsize>
</softShadowLight> |
- Position sets the position of the light
- Rotation sets the rotation of the light in degrees
- Length sets the dimension of the light along the x-Axis
- Epsilon is the upper error bound which can be modified in the GUI system
- Mapsize defines the size of the shadow maps
envObject:
<envObject>
<position>
<x>145</x>
<y>0</y>
<z>150</z>
</position>
<rotation>
<x>90</x>
<y>90</y>
<z>0</z>
</rotation>
<xfile>./media/models/Wand.x</xfile>
<id>1</id>
<fixed>1</fixed>
</envObject> |
- Position sets the position of the given object
- Rotation sets the rotation of the given object in degrees
- XFile sets the name of the .x file to be loaded
- Id tells the application in which scene the object should be displayed. Switch a scene by pressing keys 1 – 6.
- Fixed defines whether the object should response to movement and rotation commands initiated by the user. It is sometimes useful that the shadowcaster can be rotated while the receivers stay on their place.
Application configuration:
To change the size of the window or switch to fullscreen mode, open the file config.xml.